#include #include using namespace std; void main() { int year; int month; int day; bool isValid = true; cout << "Year: "; cin >> year; cout << "Month: "; cin >> month; cout << "Day: "; cin >> day; if(month < 1 || month > 12) { isValid = false; } else { if(month == 2) { if(year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)) { if(day > 29 || day < 1) { isValid = false; } } else { if(day > 28 || day < 1) { isValid = false; } } } else if(month == 9 || month == 4 || month == 6 || month == 11) { if(day > 30 || day < 1) { isValid = false; } } else { if(day > 31 || day < 1) { isValid = false; } } } if(isValid) { cout << "The date is valid" << endl; } else { cout << "The date is not valid" << endl; } ////int - 4 byte whole number ////float - 4 byte floating point number ////double - 8 byte floating point number //const double GRAVITY = 9.8; //constant //double time = 0; //double initialHeight; //double currentHeight; //double speed; //cout << "Initial height for object to fall from? "; //cin >> initialHeight; //cout.precision(4); //cout.setf(ios_base::fixed); //currentHeight = initialHeight; //int loopCounter = 100; //while(currentHeight > 0) //{ // speed = GRAVITY * time; // currentHeight = initialHeight - (speed/2 * time); // if(loopCounter == 100) // { // cout << setw(5) << time; // cout << setw(10) << speed; // cout << setw(10) << currentHeight << endl; // loopCounter = 0; // } // loopCounter++; // time = time + .0001; //} //cout << setw(5) << time; //cout << setw(10) << speed; //cout << setw(10) << currentHeight << endl; }